OPC Studio User's Guide and Reference
Python (COM) Examples
Client and Subscriber Development > Examples > Examples in the Product and on the Web > COM Examples > Python (COM) Examples
In This Topic

Although OPC Data Client can be used from Python over the COM API, as described in this article, this approach is now deprecated. The examples that use this approach are kept in the product for completeness only. With current OPC Data Client versions, you should install and import the Python Packages, which in turn use the Python.NET package to expose the OPC Data Client API to your Python code.

There is a comprehensive set of examples using this new approach. See .NET and Python Examples.

With some earlier OPC Data Client versions, the examples were tested in Python 3.4.2, with pywin32-219 extension (Build 219). With OPC Data Client 2018.3, 2019.2, 2023.1 and 2023.2, the examples were tested in Python 3.6 (64-bit), and pywin32 (223) extension.  

In C:\PythonXX\Scripts, do:

pip install pypiwin32

 

The location can also be like

- C:\Users\userName\AppData\Local\Programs\Python\Python36-32\Scripts, or

- C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python39_64\Scripts.

 

We were not able to make COM event notifications work in Python (COM). For this reason, examples that work with events do so using the Event Pull Mechanism.

Using Python Examples from Visual Studio

Here are some pieces of advise related to this mode of usage we have figured out. You may be well accustomed with them... but we weren't.

 

See Also